import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { Workflow, WorkflowParams } from '../interfaces/workflow.interface';

@Schema({ timestamps: true })
export class GenerationCache extends Document {
    @Prop({ required: true, unique: true })
    key: string;

    @Prop({ type: Object, required: true })
    workflow: Workflow;

    @Prop({ type: Object, required: true })
    params: WorkflowParams;

    @Prop({ required: true })
    imageUrl: string;

    @Prop({ type: Date, required: true })
    createdAt: Date;
}

export const GenerationCacheSchema = SchemaFactory.createForClass(GenerationCache); 